
#ifndef   __COMMUNICATION_MODULE
#define   __COMMUNICATION_MODULE

#define   MODEM_REC_BUFFER_SIZE		164
#define   AUX_PORT_REC_BUFFER_SIZE	200

#define   MODEM_NEW_MESSAGE_COMPLETE 			1
#define   MODEM_NEW_MESSAGE_PART					2
#define   DATA_MODE_CONNECT						3
#define   DATA_MODE_RECEIVE_COMPLETE			4
#define   DATA_MODE_ESCAPE							5
#define   AUX_PORT_RECEIVE_COMPLETE				6
#define   MODEM_RESPONSE_BUSY						7

#define   MODEM_ERROR								0xFE
#define   DATA_MODE_CHECKSUM_ERRORS				MODEM_ERROR

extern unsigned char near ModemEvents;
extern unsigned char near AuxPortEvents;
//extern volatile unsigned char  ModemReceiveStatus;
//extern volatile unsigned char pModemRecBuffer;
//extern volatile bit FLOW_CONTROL;

//extern unsigned char bank1 Mod_Rec_Buff[MODEM_REC_BUFFER_SIZE];
extern unsigned char ModemRecBuffer[MODEM_REC_BUFFER_SIZE];
extern unsigned char AuxPortRecBuffer[AUX_PORT_REC_BUFFER_SIZE];

extern unsigned int near ReceiverBytesCount;

//extern unsigned char Escape;				 		 /* over from DATA mode to COMMAND mode */

#define   MODEM_RX_1		0
#define   MODEM_RX_2		1

extern volatile near bit RECEIVER;

/* USART function */
void Modem_RX_1 ( void ); 
void Modem_RX_2 ( void );
void Aux_Port_RX ( void );
void ReceiverReset( void );

/* Communication */
void Drive_Receivers( void );


#endif

